package meituan;

import java.util.Scanner;
// 小美的合并数组
public class Main {
    private static final int MOD = 1000000007;
    private static int n, k;
    private static int[] arr;
    private static int[][] dp;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        k = scanner.nextInt();
        arr = new int[n];

        int maxSum = 0;
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
            maxSum += arr[i];
        }

        // 初始化DP数组，值为-1表示尚未计算过
        dp = new int[n + 1][maxSum + 1];
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= maxSum; j++) {
                dp[i][j] = -1;
            }
        }

        int result = dfs(0, 0);
        System.out.println(result);
    }

    private static int dfs(int i, int p) {
        if (i == n) {
            return p >= k ? 1 : 0;
        }
        if (dp[i][p] != -1) {
            return dp[i][p];
        }

        int cnt = 0;
        if (p >= k) {
            cnt = (cnt + dfs(i + 1, arr[i])) % MOD;
            cnt = (cnt + dfs(i + 1, p + arr[i])) % MOD;
        } else {
            cnt = (cnt + dfs(i + 1, p + arr[i])) % MOD;
        }

        dp[i][p] = cnt;
        return dp[i][p];
    }
}
